/*****************************************************************************
 * Copyright (C) Stacy Curl. All rights reserved.                            *
 * ------------------------------------------------------------------------- *
 * The software in this package is published under the terms of the BSD      *
 * style license a copy of which has been included with this distribution in *
 * the LICENSE.txt file.                                                     *
 *****************************************************************************/
package picounit.features.verify;

import picounit.features.verify.constraint.ArrayUtil;
import picounit.features.verify.constraint.ComparesTo;
import picounit.features.verify.constraint.Comparitor;
import picounit.features.verify.constraint.DifferentTo;
import picounit.features.verify.constraint.EqualTo;
import picounit.features.verify.constraint.EqualToComparitor;
import picounit.features.verify.constraint.GreaterThanComparitor;
import picounit.features.verify.constraint.LessThanComparitor;
import picounit.features.verify.constraint.Modifier;
import picounit.features.verify.constraint.OrComparitor;
import picounit.features.verify.constraint.PrimativeArrayContains;
import picounit.features.verify.constraint.PrimativeArrayDoesNotContain;
import picounit.features.verify.constraint.Stringer;
import picounit.verify.constraint.Constraint;

public class ConstraintFactory {
	private final ArrayUtil arrayUtil = new ArrayUtil();
	private final Comparitor greaterThanComparitor = new GreaterThanComparitor();
	private final Comparitor equalToComparitor = new EqualToComparitor();
	private final Comparitor lessThanComparitor = new LessThanComparitor();
	
	private final Comparitor greaterThanOrEqualToComparitor =
		new OrComparitor(greaterThanComparitor, equalToComparitor);

	private final Comparitor lessThanOrEqualToComparitor =
		new OrComparitor(lessThanComparitor, equalToComparitor);

	public Constraint primativeArrayContains(Object contains, Modifier modifier) {
		return new PrimativeArrayContains(contains, modifier, arrayUtil);
	}

	public Constraint primativeArrayDoesNotContain(Object doesNotContain, Modifier modifier) {
		return new PrimativeArrayDoesNotContain(doesNotContain, modifier, arrayUtil);
	}

	public Constraint equalTo(Object equalTo, Modifier modifier, Stringer stringer) {
		return new EqualTo(equalTo, modifier, stringer);
	}

	public Constraint differentTo(Object equalTo, Modifier modifier, Stringer stringer) {
		return new DifferentTo(equalTo, modifier, stringer);
	}

	public Constraint greaterThan(Object greaterThan, Modifier modifier) {
		return new ComparesTo(greaterThan, modifier, greaterThanComparitor);
	}

	public Constraint greaterThanOrEqualTo(Object greaterThanOrEqualTo, Modifier modifier) {
		return new ComparesTo(greaterThanOrEqualTo, modifier, greaterThanOrEqualToComparitor);
	}

	public Constraint lessThan(Object lessThan, Modifier modifier) {
		return new ComparesTo(lessThan, modifier, lessThanComparitor);
	}

	public Constraint lessThanOrEqualTo(Object lessThanOrEqualTo, Modifier modifier) {
		return new ComparesTo(lessThanOrEqualTo, modifier, lessThanOrEqualToComparitor);
	}
}
